# 打印一个字符串的全部子序列，包括空字符串
# 输入："abc"
# 输出：['', 'c', 'b', 'bc', 'a', 'ac', 'ab', 'abc']

def all_subsquences(s: str):
    res, s = [], list(s)
    process(s, 0, "", res)
    return res


def process(s: list, k: int, tmp: str, res: list):
    if k == len(s):
        res.append(tmp)
        return
    process(s, k + 1, tmp, res)
    tmp += s[k]
    process(s, k+1, tmp, res)


if __name__ == "__main__":
    print(all_subsquences("abc"))

